﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;

namespace My.Domain.Orders
{
    /// <summary>
    /// 订单明细
    /// </summary>
    public class OrderLine : Entity
    {
        /// <summary>
        /// 订单id
        /// </summary>
        public Guid OrderId { get; protected set; }

        /// <summary>
        /// 产品id
        /// </summary>
        public Guid ProductId { get; protected set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Count { get; protected set; }

        protected OrderLine() { }

        internal OrderLine(Guid orderId, Guid productId, int count)
        {
            OrderId = orderId;
            ProductId = productId;
            Count = count;
        }

        internal void ChangeCount(int newCount)
        {
            Count = newCount;
        }

        public override object[] GetKeys()
        {
            return new object[] { OrderId, ProductId };
        }
    }
}
